package com.translate.web.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import com.translate.web.config.contract.IOSSConfig;


/**
 * OSS对象存储相关配置 Created by macro on 2018/5/17.
 */
@Configuration
@ConfigurationProperties(prefix = "aliyun")
public class OssConfig implements IOSSConfig{

	private String endpoint;
	private String accessKeyId;
	private String accessKeySecret;
	
	private String modulePrefix;
	
	private String urlPrefix;
	
	private String order;
	
	private String comment;
	
	private Long size;
	
	private String rootpath;
	
	// 回款图片路径
	private String receivables;
	
	// 订单审核图片路径
	private String orderApproval;
	
	// 订单审核图片路径
	private String paymentApproval;
	
	// 商品图片路径
	private String productImag;
	
	
	private String userPrefix;
	
	private String localPicURL;
	
	private String arn;
	
	private String area;
	
	/**
	 * 有效时间
	 */
	private long durationSeconds;
	
	public String getReceivables() {
		return receivables;
	}

	public void setReceivables(String receivables) {
		this.receivables = receivables;
	}

	public String getOrderApproval() {
		return orderApproval;
	}

	public void setOrderApproval(String orderApproval) {
		this.orderApproval = orderApproval;
	}

	public String getPaymentApproval() {
		return paymentApproval;
	}

	public void setPaymentApproval(String paymentApproval) {
		this.paymentApproval = paymentApproval;
	}

	public String getProductImag() {
		return productImag;
	}

	public void setProductImag(String productImag) {
		this.productImag = productImag;
	}

	public String getOrder() {
		return order;
	}

	public void setOrder(String order) {
		this.order = order;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getModulePrefix() {
		return modulePrefix;
	}

	public void setModulePrefix(String modulePrefix) {
		this.modulePrefix = modulePrefix;
	}

	public String getUserPrefix() {
		return userPrefix;
	}

	public void setUserPrefix(String userPrefix) {
		this.userPrefix = userPrefix;
	}

	private String bucketName;
	
	

	public String getEndpoint() {
		return endpoint;
	}

	public void setEndpoint(String endpoint) {
		this.endpoint = endpoint;
	}

	public String getAccessKeyId() {
		return accessKeyId;
	}

	public void setAccessKeyId(String accessKeyId) {
		this.accessKeyId = accessKeyId;
	}

	public String getAccessKeySecret() {
		return accessKeySecret;
	}

	public void setAccessKeySecret(String accessKeySecret) {
		this.accessKeySecret = accessKeySecret;
	}

	public String getBucketName() {
		return bucketName;
	}

	public void setBucketName(String bucketName) {
		this.bucketName = bucketName;
	}

	public String getUrlPrefix() {
		return urlPrefix;
	}

	public void setUrlPrefix(String urlPrefix) {
		this.urlPrefix = urlPrefix;
	}

	public Long getSize() {
		return size;
	}

	public void setSize(Long size) {
		this.size = size;
	}

	public String getRootpath() {
		return rootpath;
	}

	public void setRootpath(String rootpath) {
		this.rootpath = rootpath;
	}

	public String getLocalPicURL() {
		return localPicURL;
	}

	public void setLocalPicURL(String localPicURL) {
		this.localPicURL = localPicURL;
	}

	public String getArn() {
		return arn;
	}

	public void setArn(String arn) {
		this.arn = arn;
	}

	public long getDurationSeconds() {
		return durationSeconds;
	}

	public void setDurationSeconds(long durationSeconds) {
		this.durationSeconds = durationSeconds;
	}

	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}
	
	public String getURL() {
		return "https://".concat(this.getBucketName()
				.concat(".").concat(this.getEndpoint()));
	}
	
	public String getNoPerfixURL() {
		return (this.getBucketName()
				.concat(".").concat(this.getEndpoint()));
	}
}